/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.spring66.tutorial.web.controller;

import com.spring66.tutorial.service.AppUserService;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

/**
 *
 * @author TwinP
 */
public class SimpleJsonGetController implements Controller {

    private AppUserService appUserService;
//        ['Verizon Communications',35.57,0.39,1.11,'9/1 12:00am'],
//       ['Wal-Mart Stores, Inc.',45.45,0.73,1.63,'9/1 12:00am']

    @Override
    public ModelAndView handleRequest(HttpServletRequest arg0, HttpServletResponse arg1) throws Exception {
        //System.out.println("SimpleJsonGetController");
        Map model = new HashMap();
        model.put("model", this.appUserService.getUsers(null));
        return new ModelAndView("jsonView", model);
    }

    /**
     * @return the appUserService
     */
    public AppUserService getAppUserService() {
        return appUserService;
    }

    /**
     * @param appUserService the appUserService to set
     */
    public void setAppUserService(AppUserService appUserService) {
        this.appUserService = appUserService;
    }
}
